<template>
  <IFexHeaderMain>
    <!-- 头部区域 -->
    <template #header>
      <IHeader :bankUrl="bankUrl">{{ userName || '网点管理' }}</IHeader>
      <!-- 搜索框 -->
      <!-- <view class="search-container">
        <uni-search-bar @confirm="handleSearch" v-model="searchValue" @clear="handleSearch" placeholder="请输入网点名称"> </uni-search-bar>
      </view> -->
    </template>

    <!-- 数据列表区域 -->
    <view class="page-container wh_auto">
      <DataCard :data="item" v-for="(item, index) in dataList" :key="index" />
      <view class="wrapper whov" v-if="dataList.length === 0">
        <view class="empty-state"> 暂无数据 </view>
      </view>
    </view>
  </IFexHeaderMain>
</template>

<script setup lang="ts" name="index">
  import { ref, computed, onMounted } from 'vue'
  import IFexHeaderMain from '@/components/container/IFexHeaderMain.vue'
  import IHeader from '@/components/container/IHeader.vue'
  import DataCard from './DataCard.vue'
  import { getNetworkPoint } from '@/api/zmanager/outlets'
  import useUserInfoStore from '@/store/userInfo'
  import useToastMsg from '@/hooks/sysMsg'
  import { onLoad } from '@dcloudio/uni-app'
  const userInfoStore = useUserInfoStore()
  const toastMsg = useToastMsg()
  // 模拟原始数据
  const dataList = ref<any[]>([])
  const userId = ref('')
  const userName = ref('')
  // 搜索关键词
  const searchValue = ref('')
 const bankUrl = computed(() => (userInfoStore.getPlatformType == 'gld' ? '/pages/zmanager/index/index' : '/pages/invest/index/index'))
  onLoad(async (options: any) => {
    userId.value = options.userId || ''
    userName.value = options.userName || ''
  })
  onMounted(() => init())
  const init = async () => {
    toastMsg.showLoading()
    const result = await getNetworkPoint(userId.value || userInfoStore.getUserInfo.userId)
    if (result) {
      dataList.value = result.data.npList
    }
    toastMsg.hideLoading()
  }
</script>

<style scoped>
  .page-container {
    padding: 20rpx;
    background: #f5f5f5;
  }
</style>
